#!/usr/bin/perl 

#use strict;
use CGI qw(:all);
use CGI::Carp qw( fatalsToBrowser );



print "Content-Type: text/html\n\n";

my $script="reg.cgi";

my $all_message;
my $cgi = new CGI;
my $name = $cgi->param('name');
my $dept = $cgi->param('dept');
my $xys_id = $cgi->param('xys_id');
my $blog_id = $cgi->param('blog_id');
my $tel = $cgi->param('tel');
my $message = $cgi->param('msg');
my $user_email = $cgi->param('email');
my @match = $cgi->param('match');
my @match_double = $cgi->param('match_double');
my $m_msg;
my $subject="DE-SCI BLOG Application";

my $match_str = $match[0] ." ". $match[1] . " ".  $match_double[0];

$all_message=<<EOP;

Thanks for your registration!

Name    : $name
Dept    : $dept
blog id : $blog_id
XYS-ID  : $xys_id
Mail    : $user_email
Articles: 
$message

EOP

$m_msg=$all_message;
$m_msg.=<<EOP;

--------------------------
Online registration system for DE-SCI BLOG.
http://www.de-sci.org/blogs

EOP

my $IPADD=$ENV{"REMOTE_ADDR"};
my $m_msg_admin=$all_message;
$m_msg_admin .=<<EOP;

(Only for admin: IP Address= $IPADD )

1）  
很抱歉，本站暂时不能为你开启博客，欢迎您继续关注德赛公园，参与相关活动。

审核意见：


2）
请提供已经发表的三篇文章的网址。

3） 
如果只是留言，不用注册。
如果希望开通博客，请提供已经发表的三篇文章的网址。

4）  
欢迎来到德赛公园开设博客，请确认系统发出的包含密码的邮件。

关于本站的入门介绍，请参看：
http://www.de-sci.org/blogs/sys_admin/ccaceaez/
更为详细的使用大全：
http://www.de-sci.org/blogs/alpha000001/?p=10384

联系方式：
站长: admin\@sidepark.org
技术咨询： tech\@sidepark.org




--------------------------
Online registration system for DE-SCI BLOG.
http://www.de-sci.org/blogs

EOP


use MIME::Lite;
my $mailfrom="DE-SCI Blog <admin\@xys-reader.org>";
my $mailto="xfliu.math\@gmail.com";

if( $cgi->param('verify')=~ /reader/ ){

	if($user_email){

	my $msg = MIME::Lite->new( From =>$mailfrom, To =>$user_email, Subject =>"$subject", Type => 'multipart/mixed');
	$msg->attach( Type => 'text/plain; charset="utf-8"', Data => "$m_msg");
	$msg->send();

	my $msg = MIME::Lite->new( From =>$user_email, To =>$mailto, Subject =>"$subject-$blog_id", Type => 'multipart/mixed');
	$msg->attach( Type => 'text/plain; charset="utf-8"', Data => "$m_msg_admin");
	$msg->send();

	}
	else{
		
		$err_info="Error in email address.<br>";

	}
}
else{
		$err_info="请输入验证码。<br>";

}
print <<EOF;

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
 <head>
  <title>注册确认</title>
 <LINK REL="stylesheet" HREF="my.css">
 <meta http-equiv="Content-Type"   content="text/html; charset=UTF-8">
<META NAME='KEYWORDS' CONTENT=''>
 <META NAME="description" content="Registeratio sys.">

 </head>
 <body>

<br>
<h1>德赛公园博客注册系统</h1>


<font size=4 color=red>$err_info</font>



EOF

print <<EOF if not $err_info;

<h3>下面是您的注册信息。确认邮件已发出，请查收。</h3>

<hr size=1>
<blockquote>
<pre>
$all_message
</pre>
</blockquote>
EOF

print <<EOF;

<hr size=1>
<div align="right">
<a href="javascript:history.back()">[Back]</a>
</div>

<p><p><p><p><p>
<div align="right"><a href="http://www.de-sci.org">德赛公园</a><br>
2008/12/01
</div>


</body>
</html>

EOF
